<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Portainer Docker 入门教程</title>
    <meta name="description" content="Portainer 是一个开源、轻量级Docker管理用户界面，基于Docker API，提供状态显示面板、应用模板快速部署、容器镜像网络数据卷的基本操作（包括上传下载镜像，创建容器等操作）、事件日志显示、容器控制台操作、Swarm集群和服">
    <meta name="keywords" content="docker,containers,tutorial">
    <link rel="stylesheet" type="text/css" href="css/main.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="css/tocbot.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="css/media.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="css/sidebar.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="css/copy.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="css/demo-preview.css?v=1.29.0">
    <link rel="icon" href="img/logo.svg" type="image/x-icon">
    <script src="js/copy.js?v=1.29.0"></script>
    <script src="js/dark-mode.js?v=1.29.0"></script>
    <script src="js/markdown-style.js?v=1.29.0"></script>
  </head>
  <body id="idoctotop"><a href="#idoctotop" class="gototop">top</a>
    <header class="header">
      <article class="inner warpper"><a class="logo" href="index.html"><svg viewBox="0 0 1280 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <path d="M699.88718 472.6h-132.2v-118.8h132.2v118.8z m0-408.6h-132.2v121.4h132.2V64z m156.4 289.6H724.08718v118.8h132.2v-118.8z m-312.6-144.2h-132.2v120.2h132.2v-120.2z m156.2 0h-132.2v120.2h132.2v-120.2z m553.6 200c-28.8-19.4-95.2-26.4-146.2-16.8-6.6-48-33.4-89.8-82.2-127.4l-28-18.6-18.6 28c-36.8 55.6-46.8 147.2-7.4 207.6-17.4 9.4-51.6 22.2-96.8 21.4H4.88718c-17.4 101.6 11.6 233.6 88 324.2 74.2 87.8 185.4 132.4 330.8 132.4 314.8 0 547.8-145 656.8-408.4 42.8 0.8 135.2 0.2 182.6-90.4 3-5 13.2-26.4 17-34.2l-26.6-17.8z m-1022.2-55.8h-132v118.8h132.2v-118.8z m156.2 0h-132.2v118.8h132.2v-118.8z m156.2 0h-132.2v118.8h132.2v-118.8z m-156.2-144.2h-132.2v120.2h132.2v-120.2z" fill="#0187D1"></path>
          </svg>
<span class="title">Docker 入门教程</span></a>
        <div class="content">
          <ul class="menu">
            <li><a href="index.html" target="" class="">Home</a></li>
            <li><a href="https://wangchujiang.com/#/sponsor" target="__blank" class="">Sponsor</a></li>
          </ul><a href="https://github.com/jaywcjlove/docker-tutorial" target="_blank" rel="noopener noreferrer" title="Github" name="Github" class="github"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
            </svg></a>
          <dark-mode permanent=""></dark-mode>
        </div>
      </article>
    </header>
    <div class="warpper-content warpper sidebar">
      <div class="sidebar-border">
        <aside class="sidebar" role="navigation">
          <div>
            <a href="index.html" class="">入门</a>
            <label>实践</label>
            <a href="docker-compose.html" class="">Docker Compose</a>
            <a href="elasticsearch.html" class="">ElasticSearch 搜索服务器</a>
            <a href="gitlab/index.html" class="">Gitlab 代码仓库管理系统</a>
            <a href="harbor.html" class="">Harbor</a>
            <a href="mattermost.html" class="">Mattermost 聊天工具</a>
            <a href="mysql.html" class="">MySQL 数据库</a>
            <a href="nginx.html" class="">Nginx Web 服务器</a>
            <a href="nps/index.html" class="">NPS 内网穿透</a>
            <a href="portainer.html" class="active">Portainer Docker 管理</a>
            <a href="postgres.html" class="">PostgreSQL 数据库</a>
            <a href="penpot.html" class="">Penpot 设计和原型</a>
            <a href="navidrome.html" class="">Navidrome 音乐服务器</a>
            <a href="rancher.html" class="">Rancher 容器管理平台</a>
            <a href="redis.html" class="">Redis 数据库</a>
            <a href="rocket.chat/index.html" class="">Rocket.Chat 聊天工具</a>
            <a href="seaweedfs/index.html" class="">SeaweedFS 文件系统</a>
            <a href="sourcegraph/index.html" class="">Sourcegraph 代码搜索引擎</a>
          </div>
        </aside>
      </div>
      <markdown-style theme-auto-switch-disabled="">
        <h1 id="portainer"><a aria-hidden="true" tabindex="-1" href="#portainer" class="anchor"><span class="icon icon-link"></span></a>Portainer</h1>
        <p><a href="https://github.com/portainer/portainer">Portainer</a> 是一个开源、轻量级Docker管理用户界面，基于Docker API，提供状态显示面板、应用模板快速部署、容器镜像网络数据卷的基本操作（包括上传下载镜像，创建容器等操作）、事件日志显示、容器控制台操作、Swarm集群和服务等集中管理和操作、登录用户管理和控制等功能。功能十分全面，基本能满足中小型单位对容器管理的全部需求。</p>
        <h2 id="v2-安装"><a aria-hidden="true" tabindex="-1" href="#v2-安装" class="anchor"><span class="icon icon-link"></span></a>v2 安装</h2>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">docker</span> volume create portainer_data
</span></code><input type="hidden" value="docker volume create portainer_data
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>Docker Standalone</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">docker</span> run <span class="token parameter variable">-d</span> <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="2">  <span class="token parameter variable">-p</span> <span class="token number">8000</span>:8000 <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="3">  <span class="token parameter variable">-p</span> <span class="token number">9000</span>:9000 <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="4">  <span class="token parameter variable">--name</span><span class="token operator">=</span>portainer <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="5">  <span class="token parameter variable">--restart</span><span class="token operator">=</span>always <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="6">  <span class="token parameter variable">-v</span> /var/run/docker.sock:/var/run/docker.sock <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="7">  <span class="token parameter variable">-v</span> portainer_data:/data <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="8">  portainer/portainer-ce
</span></code><input type="hidden" value="docker run -d \
  -p 8000:8000 \
  -p 9000:9000 \
  --name=portainer \
  --restart=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer_data:/data \
  portainer/portainer-ce
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>Docker Swarm</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">curl</span> <span class="token parameter variable">-L</span> https://downloads.portainer.io/ee2-18/portainer-agent-stack.yml <span class="token parameter variable">-o</span> portainer-agent-stack.yml
</span><span class="code-line line-number" line="2"><span class="token comment"># 下载 https://downloads.portainer.io/portainer-agent-stack.yml</span>
</span><span class="code-line line-number" line="3"><span class="token function">docker</span> stack deploy <span class="token parameter variable">-c</span> portainer-agent-stack.yml portainer
</span></code><input type="hidden" value="curl -L https://downloads.portainer.io/ee2-18/portainer-agent-stack.yml -o portainer-agent-stack.yml
# 下载 https://downloads.portainer.io/portainer-agent-stack.yml
docker stack deploy -c portainer-agent-stack.yml portainer
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <h2 id="v122x"><a aria-hidden="true" tabindex="-1" href="#v122x" class="anchor"><span class="icon icon-link"></span></a>v1.22x</h2>
        <p>新建 <code>portainer-agent-stack.yml</code> 文件， 将下面内容复制到配置文件中，你可以从官方仓库拷贝 <a href="https://github.com/portainer/portainer-compose"><code>portainer/portainer-compose</code></a> 配置。</p>
        <pre class="language-yml"><code class="language-yml code-highlight"><span class="code-line line-number" line="1"><span class="token key atrule">version</span><span class="token punctuation">:</span> <span class="token string">'3.2'</span>
</span><span class="code-line line-number" line="2"><span class="token key atrule">services</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="3">  <span class="token key atrule">agent</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="4">    <span class="token key atrule">image</span><span class="token punctuation">:</span> portainer/agent
</span><span class="code-line line-number" line="5">    <span class="token key atrule">environment</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="6">      <span class="token comment"># REQUIRED: Should be equal to the service name prefixed by "tasks." when</span>
</span><span class="code-line line-number" line="7">      <span class="token comment"># deployed inside an overlay network</span>
</span><span class="code-line line-number" line="8">      <span class="token key atrule">AGENT_CLUSTER_ADDR</span><span class="token punctuation">:</span> tasks.agent
</span><span class="code-line line-number" line="9">      <span class="token comment"># AGENT_PORT: 9001</span>
</span><span class="code-line line-number" line="10">      <span class="token comment"># LOG_LEVEL: debug</span>
</span><span class="code-line line-number" line="11">    <span class="token key atrule">volumes</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="12">      <span class="token punctuation">-</span> /var/run/docker.sock<span class="token punctuation">:</span>/var/run/docker.sock
</span><span class="code-line line-number" line="13">      <span class="token punctuation">-</span> /var/lib/docker/volumes<span class="token punctuation">:</span>/var/lib/docker/volumes
</span><span class="code-line line-number" line="14">      <span class="token punctuation">-</span> /etc/localtime<span class="token punctuation">:</span>/etc/localtime<span class="token punctuation">:</span>ro
</span><span class="code-line line-number" line="15">    <span class="token key atrule">networks</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="16">      <span class="token punctuation">-</span> agent_network
</span><span class="code-line line-number" line="17">    <span class="token key atrule">deploy</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="18">      <span class="token key atrule">mode</span><span class="token punctuation">:</span> global
</span><span class="code-line line-number" line="19">      <span class="token key atrule">placement</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="20">        <span class="token key atrule">constraints</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>node.platform.os == linux<span class="token punctuation">]</span>
</span><span class="code-line line-number" line="21">
</span><span class="code-line line-number" line="22">  <span class="token key atrule">portainer</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="23">    <span class="token key atrule">image</span><span class="token punctuation">:</span> portainer/portainer
</span><span class="code-line line-number" line="24">    <span class="token key atrule">command</span><span class="token punctuation">:</span> <span class="token punctuation">-</span>H tcp<span class="token punctuation">:</span>//tasks.agent<span class="token punctuation">:</span>9001 <span class="token punctuation">-</span><span class="token punctuation">-</span>tlsskipverify
</span><span class="code-line line-number" line="25">    <span class="token key atrule">ports</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="26">      <span class="token punctuation">-</span> <span class="token string">"9000:9000"</span>
</span><span class="code-line line-number" line="27">    <span class="token key atrule">volumes</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="28">      <span class="token punctuation">-</span> portainer_data<span class="token punctuation">:</span>/data
</span><span class="code-line line-number" line="29">      <span class="token punctuation">-</span> /etc/localtime<span class="token punctuation">:</span>/etc/localtime<span class="token punctuation">:</span>ro
</span><span class="code-line line-number" line="30">    <span class="token key atrule">networks</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="31">      <span class="token punctuation">-</span> agent_network
</span><span class="code-line line-number" line="32">    <span class="token key atrule">deploy</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="33">      <span class="token key atrule">mode</span><span class="token punctuation">:</span> replicated
</span><span class="code-line line-number" line="34">      <span class="token key atrule">replicas</span><span class="token punctuation">:</span> <span class="token number">1</span>
</span><span class="code-line line-number" line="35">      <span class="token key atrule">placement</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="36">        <span class="token key atrule">constraints</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>node.role == manager<span class="token punctuation">]</span>
</span><span class="code-line line-number" line="37">
</span><span class="code-line line-number" line="38"><span class="token key atrule">networks</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="39">  <span class="token key atrule">agent_network</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="40">    <span class="token key atrule">driver</span><span class="token punctuation">:</span> overlay
</span><span class="code-line line-number" line="41">    <span class="token key atrule">attachable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
</span><span class="code-line line-number" line="42">
</span><span class="code-line line-number" line="43"><span class="token key atrule">volumes</span><span class="token punctuation">:</span>
</span><span class="code-line line-number" line="44">  <span class="token key atrule">portainer_data</span><span class="token punctuation">:</span>
</span></code><input type="hidden" value="version: &#x27;3.2&#x27;
services:
  agent:
    image: portainer/agent
    environment:
      # REQUIRED: Should be equal to the service name prefixed by &#x22;tasks.&#x22; when
      # deployed inside an overlay network
      AGENT_CLUSTER_ADDR: tasks.agent
      # AGENT_PORT: 9001
      # LOG_LEVEL: debug
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
      - /etc/localtime:/etc/localtime:ro
    networks:
      - agent_network
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]

  portainer:
    image: portainer/portainer
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    ports:
      - &#x22;9000:9000&#x22;
    volumes:
      - portainer_data:/data
      - /etc/localtime:/etc/localtime:ro
    networks:
      - agent_network
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]

networks:
  agent_network:
    driver: overlay
    attachable: true

volumes:
  portainer_data:
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <h2 id="启动容器"><a aria-hidden="true" tabindex="-1" href="#启动容器" class="anchor"><span class="icon icon-link"></span></a>启动容器</h2>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">docker</span> stack deploy --compose-file<span class="token operator">=</span>portainer-agent-stack.yml portainer
</span></code><input type="hidden" value="docker stack deploy --compose-file=portainer-agent-stack.yml portainer
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <h2 id="运行容器"><a aria-hidden="true" tabindex="-1" href="#运行容器" class="anchor"><span class="icon icon-link"></span></a>运行容器</h2>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">docker</span> run <span class="token parameter variable">-d</span> <span class="token parameter variable">-p</span> <span class="token number">8000</span>:8000 <span class="token parameter variable">-p</span> <span class="token number">9000</span>:9000 <span class="token parameter variable">-p</span> <span class="token number">9443</span>:9443 <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="2">  <span class="token parameter variable">--name</span><span class="token operator">=</span>portainer <span class="token parameter variable">--restart</span><span class="token operator">=</span>always <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="3">  <span class="token parameter variable">-v</span> /var/run/docker.sock:/var/run/docker.sock <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="4">  <span class="token parameter variable">-v</span> ~/_docker/portainer/data:/data <span class="token punctuation">\</span>
</span><span class="code-line line-number" line="5">  portainer/portainer-ce:latest
</span></code><input type="hidden" value="docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 \
  --name=portainer --restart=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/_docker/portainer/data:/data \
  portainer/portainer-ce:latest
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <div class="previous"><a class="prev" href="nps/index.html"><svg viewBox="0 0 1024 1024" width="16" height="16" fill="currentColor">
              <path d="M842.666667 864c-8.533333 0-14.933333-2.133333-21.333334-8.533333l-341.333333-309.333334c-6.4-6.4-10.666667-14.933333-10.666667-23.466666 0-8.533333 4.266667-17.066667 10.666667-23.466667l341.333333-309.333333c12.8-12.8 34.133333-10.666667 44.8 2.133333 12.8 12.8 10.666667 34.133333-2.133333 44.8L548.266667 522.666667l315.733333 285.866666c12.8 10.666667 14.933333 32 2.133333 44.8-6.4 6.4-14.933333 10.666667-23.466666 10.666667z"></path>
              <path d="M512 864c-8.533333 0-14.933333-2.133333-21.333333-8.533333L149.333333 546.133333c-6.4-6.4-10.666667-14.933333-10.666666-23.466666 0-8.533333 4.266667-17.066667 10.666666-23.466667L490.666667 189.866667c12.8-12.8 34.133333-10.666667 44.8 2.133333 12.8 12.8 10.666667 34.133333-2.133334 44.8L217.6 522.666667 533.333333 808.533333c12.8 12.8 14.933333 32 2.133334 44.8-6.4 6.4-14.933333 10.666667-23.466667 10.666667z"></path>
            </svg>
<span>NPS 内网穿透
</span></a><a class="next" href="postgres.html"><span>PostgreSQL 数据库
</span><svg viewBox="0 0 1024 1024" width="16" height="16" fill="currentColor">
              <path d="M544 522.666667c0-8.533333-4.266667-17.066667-10.666667-23.466667L192 189.866667c-12.8-12.8-34.133333-10.666667-44.8 2.133333-12.8 12.8-10.666667 34.133333 2.133333 44.8l315.733334 285.866667L149.333333 808.533333c-12.8 12.8-14.933333 32-2.133333 44.8 6.4 6.4 14.933333 10.666667 23.466667 10.666667 8.533333 0 14.933333-2.133333 21.333333-8.533333l341.333333-309.333334c6.4-6.4 10.666667-14.933333 10.666667-23.466666z"></path>
              <path d="M864 499.2l-341.333333-309.333333c-12.8-12.8-34.133333-10.666667-44.8 2.133333-12.8 12.8-10.666667 34.133333 2.133333 44.8l315.733333 285.866667-315.733333 285.866666c-12.8 12.8-14.933333 32-2.133333 44.8 6.4 6.4 14.933333 10.666667 23.466666 10.666667 8.533333 0 14.933333-2.133333 21.333334-8.533333l341.333333-309.333334c6.4-6.4 10.666667-14.933333 10.666667-23.466666 0-8.533333-4.266667-17.066667-10.666667-23.466667z"></path>
            </svg></a></div>
        <section class="article-footer"><a href="https://github.com/jaywcjlove/docker-tutorial/tree/master/docs/portainer.md" class="edit-button" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
            </svg>
<span>Edit this page on GitHub</span>
</a><span class="atime">2022/04/20</span></section>
      </markdown-style>
      <nav class="tocs">
        <aside class="inner toc">
          <ol class="tocs-list">
            <li><a href="#v2-安装" class="tocs-link">v2 安装</a></li>
            <li><a href="#v122x" class="tocs-link">v1.22x</a></li>
            <li><a href="#启动容器" class="tocs-link">启动容器</a></li>
            <li><a href="#运行容器" class="tocs-link">运行容器</a></li>
          </ol>
        </aside>
      </nav>
    </div>
    <script src="js/demo-preview.js?v=1.29.0"></script>
    <div class="footer warpper">
      <a href="https://wangchujiang.com/#/app" target="_blank">App</a> •
      <a href="https://wangchujiang.com/#/projects" target="_blank">Projects</a> •
      <a href="https://wangchujiang.com/#/sponsor" target="_blank">Sponsor</a> •
      <a href="https://wangchujiang.com/#/app" target="_blank">More Apps</a><br><br>Released under the MIT License. Copyright © 2024 <a href="https://wangchujiang.com/#/about" target="_blank">Kenny Wong</a><br>Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a> v1.29.0
    </div>
    <script src="js/tocbot.js?v=1.29.0"></script>
  </body>
</html>
